package com.ums.upos.service;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;

import com.ums.upos.GlobalDataHolder;

import org.greenrobot.eventbus.EventBus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by xiaox on 2016/10/10.
 */

public class AmountReceiver extends BroadcastReceiver {
    public static final String ACTION = "com.ums.tss.showamount";
    public static final String KEY_AMOUNT = "amount";
    private Logger log = LoggerFactory.getLogger("AMOUNTRECEIVER");
    @Override
    public void onReceive(Context context, Intent intent) {
        Bundle bundle = intent.getExtras();
        String amt = bundle.getString(KEY_AMOUNT);
        log.debug("收到金额广播 {}",amt);
        if (!TextUtils.isEmpty(amt)) {
            GlobalDataHolder.getInstance().setShowAmount(amt);
            EventBus.getDefault().post(this);
        }
    }
}
